package com.yc.login.biz;

import com.yc.login.dao.UserDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class UserBiz {
    @Resource
    private UserDao userDao;

    public Map<String, Object> login(String username, String password) throws BizException {
        if (username == null || username.isEmpty()){
            throw new BizException("请填写用户名!");
        }
        if (password == null || password.isEmpty()){
            throw new BizException("请填写密码!");
        }
        Map<String, Object> user = userDao.login(username,password);
        if (user == null){
            throw new BizException("用户名或密码错误!");
        }
        return user;
    }
}
